<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>邮箱验证</title>
	</head>
	<script>
		var e=prompt("请输入正确的邮箱地址：");
		alert(e);
		var index=e.lastIndexOf(".");
		var ind=e.indexOf("@");
		if(index!=-1&&index!=0&&e.substring(index+1,e.length)=="com"&&ind!=-1&&(index>ind)){
			var name=e.substring(0,ind);
			alert("邮箱地址正确，邮箱名称是："+name);
		}else if(e==null){
			alert("邮箱不能为空！");
		}else if(index==-1||ind==-1){
			alert("邮箱地址必须包含@和.");
		}else{
			alert("您输入的邮箱格式不正确！");
		}		
	</script>
	<body>
	</body>
</html>
